<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/html/MyTag.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="/Style/skin.css" />
       <script type="text/javascript" src="html/Js/jquery-1.9.1.min.js"></script>
    
    <script type="text/javascript">				
    		
    		function checkName(){
    		var name=document.getElementById("name").value;
    		var span=document.getElementById("nameMsg");
    		if(name){
				var regex=/^[\u4e00-\u9fa5]{2,4}$/;
				if(name.match(regex)){
					span.innerHTML="<img src='html/Images/true.jpg'/>";
					return true;
				}else{
					span.innerHTML="<img src='html/Images/false.jpg'/><font color='red'>客户姓名格式不正确</font>";
				}
			}else{
				span.innerHTML="<img src='html/Images/false.jpg'/><font color='red'>必填</font>";
			}
			return false;
    		}
    		
    		function checkPhone(){
    		var name=document.getElementById("phone").value;
    		var span=document.getElementById("phoneMsg");
    		if(name){
				var regex=/^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/;
				if(name.match(regex)){
					span.innerHTML="<img src='html/Images/true.jpg'/>";
					return true;
				}else{
					span.innerHTML="<img src='html/Images/false.jpg'/><font color='red'>请输入正确的手机号码</font>";
				}
			}else{
				span.innerHTML="<img src='html/Images/false.jpg'/><font color='red'>必填</font>";
			}
			return false;
    		}
    		
    		
    		function checkEmail(){
    		var name=document.getElementById("email").value;
    		var span=document.getElementById("emailMsg");
    		if(name){
				var regex=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
				if(name.match(regex)){
					span.innerHTML="<img src='html/Images/true.jpg'/>";
					return true;
				}else{
					span.innerHTML="<img src='html/Images/false.jpg'/><font color='red'>请填写正确邮箱地址</font>";
				}
			}else{
				span.innerHTML="<img src='html/Images/false.jpg'/><font color='red'>必填</font>";
			}
			return false;
    		}
    		
    	$(function(){
    		$("#btn").click(function(){
    			if(checkName()&&checkPhone()&&checkEmail){
    				$("#form").attr("action","conContent.do?method=insert").submit();
    			}else{
    				alert("请正确填写信息");
    			}
    		});
    	});
    </script>
</head>
    <body>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <!-- 头部开始 -->
            <tr>
                <td width="17" valign="top" background="/Images/mail_left_bg.gif">
                    <img src="/Images/left_top_right.gif" width="17" height="29" />
                </td>
                <td valign="top" background="/Images/content_bg.gif">
                    <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" background="/Images/content_bg.gif">
                        <tr><td height="31"><div class="title">客户添加</div></td></tr>
                    </table>
                </td>
                <td width="16" valign="top" background="/Images/mail_right_bg.gif"><img src="/Images/nav_right_bg.gif" width="16" height="29" /></td>
            </tr>
            <!-- 中间部分开始 -->
            <tr>
                <!--第一行左边框-->
                <td valign="middle" background="/Images/mail_left_bg.gif">&nbsp;</td>
                <!--第一行中间内容-->
                <td valign="top" bgcolor="#F7F8F9">
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <!-- 空白行-->
                        <tr><td colspan="2" valign="top">&nbsp;</td><td>&nbsp;</td><td valign="top">&nbsp;</td></tr>
                        <tr>
                            <td colspan="4"></td>
                        </tr>
                        <!-- 一条线 -->
                        <tr>
                            <td height="40" colspan="4">
                                <table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
                                    <tr><td></td></tr>
                                </table>
                            </td>
                        </tr>
                        <!-- 客户资源修改开始 -->
                        <tr>
                            <td width="2%">&nbsp;</td>
                            <td width="96%">
                                <table width="100%">
                                    <tr>
                                        <td colspan="2">
                                            <form action="" method="">
                                                <table width="100%"class="cont">
                                                    <tr>
                                                        <td width="2%">&nbsp;</td>
                                                        <td width="10%">客户姓名：</td>
                                                        <td width="25%"><input class="text" type="text" id="name" name="name" onblur="checkName()" placeholder="真实姓名" />
                                                        	<span id="nameMsg"></span></td>
                                                        <td></td>
                                                        <td width="2%">&nbsp;</td>
                                                    </tr>
                                                    <tr>
                                                        <td width="2%">&nbsp;</td>
                                                        <td>客户性别：</td>
                                                        <td>
															<input type="radio" id="sex" name="sex" value="1" checked="checked"/>男&nbsp;&nbsp;
															<input type="radio" id="sex" name="sex" value="2"/>女
                                                        </td>
                                                        <td></td>
                                                        <td width="2%">&nbsp;</td>
                                                    </tr>
													<tr>
                                                        <td width="2%">&nbsp;</td>
                                                        <td>客户生日：</td>
                                                        <td><input class="text" placeholder="my97插件" /></td>
                                                        <td></td>
                                                        <td width="2%">&nbsp;</td>
                                                    </tr>
                                                    <tr>
                                                        <td width="2%">&nbsp;</td>
                                                        <td>客户类型：</td>
                                                        <td >
                                                        	<select name="type"  style="width:50px">
                                                            	<option style="width:30px"  <c:if test="${conContent.type==0}">selected</c:if> value="0" >普通用户</option>
                                                                <option style="width:30px"  <c:if test="${conContent.type==2}">selected</c:if> value="2" >银卡用户</option>
                                                                <option style="width:30px"  <c:if test="${conContent.type==1}">selected</c:if> value="1" >金卡用户</option>
                                                                <option style="width:30px"  <c:if test="${conContent.type==3}">selected</c:if> value="3" >VIP用户</option>
                                                            </select>
                                                        </td>
                                                        <td></td>
                                                        <td width="2%">&nbsp;</td>
                                                    </tr>
													<tr>
                                                        <td width="2%">&nbsp;</td>
                                                        <td>客户状态：</td>
                                                        <td >
                                                        	<select name="HKstate"  style="width:50px">
                                                            	<option style="width:30px"  <c:if test="${conContent.HKstate==2}">selected</c:if> value="2" >禁用</option>
                                                                <option style="width:30px"  <c:if test="${conContent.HKstate==1}">selected</c:if> value="1" >启用</option>
                                                                <option style="width:30px"  <c:if test="${conContent.HKstate==3}">selected</c:if> value="3" >流失</option>
                                                            </select>
                                                        </td>
                                                        <td></td>
                                                        <td width="2%">&nbsp;</td>
                                                    </tr>
													<tr>
                                                        <td width="2%">&nbsp;</td>
                                                        <td>手机：</td>
                                                        <td>
                                                        <input class="text" id="phone" name="phone" onblur="checkPhone()" placeholder="正则校验手机号码" />
                                                        	<span id="phoneMsg"></span></td>
                                                        <td></td>
                                                        <td width="2%">&nbsp;</td>
                                                    </tr>
													<tr>
                                                        <td width="2%">&nbsp;</td>
                                                        <td>办公电话：</td>
                                                        <td><input class="text"placeholder="正则验证" /></td>
                                                        <td></td>
                                                        <td width="2%">&nbsp;</td>
                                                    </tr>
													<tr>
                                                        <td width="2%">&nbsp;</td>
                                                        <td>电子邮箱：</td>
                                                        <td><input class="text"  id=""email  name="email" onblur="checkEmail()" placeholder="正则验证，唯一不重复" /></td>
                                                        <td></td>
                                                        <td width="2%">&nbsp;</td>
                                                    </tr>
													<tr>
                                                        <td width="2%">&nbsp;</td>
                                                        <td>家庭电话：</td>
                                                        <td><input class="text" placeholder="正则验证" /></td>
                                                        <td></td>
                                                        <td width="2%">&nbsp;</td>
                                                    </tr>
													<tr>
                                                        <td>&nbsp;</td>
                                                        <td>联系地址：</td>
                                                        <td><textarea placeholder="限长，如不填，数据库中默认值为暂无"></textarea></td>
                                                        <td></td>
                                                        <td>&nbsp;</td>
                                                    </tr>
													<tr>
                                                        <td>&nbsp;</td>
                                                        <td>备注信息：</td>
                                                        <td><textarea placeholder="限长，如不填，数据库中默认值为暂无"></textarea></td>
                                                        <td></td>
                                                        <td>&nbsp;</td>
                                                    </tr>
                                                    <tr>
                                                        <td>&nbsp;</td>
                                                        <td colspan="2" align="center">
															<input class="btn" onclick="location='result.html'" type="button" value="提交" />&nbsp;&nbsp;&nbsp;
															<input class="btn" onclick="history.back()" type="button" value="返回" />
														</td>
                                                        <td></td>
                                                        <td>&nbsp;</td>
                                                    </tr>
                                                </table>
                                            </form>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td width="2%">&nbsp;</td>
                        </tr>
                        <!-- 客户资源修改结束 -->
                        <tr>
                            <td height="40" colspan="4">
                                <table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
                                    <tr><td></td></tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td width="2%">&nbsp;</td>
                            <td width="51%" class="left_txt">
                                
                            </td>
                            <td>&nbsp;</td><td>&nbsp;</td>
                        </tr>
                    </table>
                </td>


                <td background="/Images/mail_right_bg.gif">&nbsp;</td>
            </tr>
            <!-- 底部部分 -->
            <tr>
                <td valign="bottom" background="/Images/mail_left_bg.gif">
                    <img src="/Images/buttom_left.gif" width="17" height="17" />
                </td>
                <td background="/Images/buttom_bgs.gif">
                    <img src="/Images/buttom_bgs.gif" width="17" height="17">
                </td>
                <td valign="bottom" background="/Images/mail_right_bg.gif">
                    <img src="/Images/buttom_right.gif" width="16" height="17" />
                </td>           
            </tr>
        </table>
    </body>
</html>
